package com.cloudcc.mobile.dao.impl;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.dao.RenWuDao;
import com.cloudcc.mobile.util.NetWork;
import com.cloudcc.mobile.util.Tools;
import com.cloudcc.mobile.util.UrlTools;
import com.litesuits.android.log.Log;

public class RenWuDaoImpl implements RenWuDao {
	/* 带权限的插入数据 */
	public String insertEvent(String data) {
		String url = "";
		String jsonString = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
			url = UrlTools.url + UrlTools.url_path
					+ "serviceName=insert&objectApiName=Event&data=[" + Data
					+ "]&binding=" + AppContext.binding;
			Log.d("request", "插入接口" + url);
			jsonString = NetWork.get(url);
		} catch (UnsupportedEncodingException e) {
			Tools.handle(e);
		}
		return jsonString;
	}

	/* 带权限的插入任务数据 */
	public String insertTask(String data) {
		String url = "";
		String jsonString = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
			url = UrlTools.url + UrlTools.url_path
					+ "serviceName=insert&objectApiName=Task&data=[" + Data
					+ "]&binding=" + AppContext.binding;
			jsonString = NetWork.get(url);
		} catch (UnsupportedEncodingException e) {
			Tools.handle(e);
		}
		return jsonString;
	}

}
